-# Admin navigation is split into link groups.
- grouped_links = links.group_by {|l| l[:topic]}

- if IntercomHelper.admin_intercom_respond_enabled?
  - content_for :extra_javascript do
    :javascript
      window.ST = window.ST || {};
      var desktop_selector = "#admin-support-link";
      var mobile_selector = "#support_left_navi_link";
      $([desktop_selector, mobile_selector].join(", ")).click(function(e) {
        e.preventDefault();
        Intercom && Intercom('show');
      });

- sel_link = (local_assigns.has_key? :selected_left_navi_link) ? selected_left_navi_link : @selected_left_navi_link

.left-navi

  .admin-left-navi-link-group-title
    = t("admin.left_hand_navigation.general")

  .admin-left-navi-link-group
    - grouped_links[:general].each do |link|
      %a{:id => link[:id], :href => link[:path], :title => link[:text], :class => (link[:name].eql?(sel_link) ? "selected left-navi-link" : "left-navi-link"), "data-uv-trigger" => link[:data_uv_trigger], :target => link[:target]}
        .left-navi-link-icon{:class => link[:icon_class]}
        .left-navi-link-text= link[:text]

  .admin-left-navi-link-group-title
    = t("admin.left_hand_navigation.users_and_transactions")

  .admin-left-navi-link-group
    - grouped_links[:manage].each do |link|
      %a{:id => link[:id], :href => link[:path], :title => link[:text], :class => (link[:name].eql?(sel_link) ? "selected left-navi-link" : "left-navi-link")}
        .left-navi-link-icon{:class => link[:icon_class]}
        .left-navi-link-text= link[:text]

  .admin-left-navi-link-group-title
    = t("admin.left_hand_navigation.configure")

  .admin-left-navi-link-group.admin-left-navi-link-group-last
    - grouped_links[:configure].each do |link|
      %a{:id => link[:id], :href => link[:path], :title => link[:text], :class => (link[:name].eql?(sel_link) ? "selected left-navi-link" : "left-navi-link")}
        .left-navi-link-icon{:class => link[:icon_class]}
        .left-navi-link-text= link[:text]


- links.each do |link|
  - if link[:name].eql?(sel_link)
    .left-navi-dropdown.toggle.with-borders.hidden-tablet{data: {toggle: '.left-navi-menu'}}
      .icon-with-text{:class => link[:icon_class]}
      .text-with-icon= link[:text]
      %i.icon-dropdown.ss-dropdown

.left-navi-menu.toggle-menu.hidden
  - links.each do |link|
    %a{:href => link[:path], :title => link[:text], :id => "#{link[:name]}_left_navi_link"}
      .icon-with-text{:class => link[:icon_class]}
      .text-with-icon= link[:text]
